/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ar.com.remiseria.dao;

import ar.com.remiseria.entities.DestinoFrecuente;
import ar.com.remiseria.utils.HibernateUtils;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;

/**
 *
 * @author gdorrego
 */
public class DestinoFrecuenteDAO extends GenericDAO{

    public List<DestinoFrecuente> getAllOrderByNombre() throws HibernateException {
        Session session = HibernateUtils.getSessionFactory().getCurrentSession();
        Transaction tx = session.beginTransaction();
        
        Criteria criteria = session.createCriteria(DestinoFrecuente.class);
        criteria.addOrder(Order.asc("nombre"));
        
        List<DestinoFrecuente> destinos = criteria.list();
        return destinos;
    }
    
    
    
}
